<?php
// +----------------------------------------------------------------------
// | Description: 用户组
// +----------------------------------------------------------------------
// | Author: linchuangbin <linchuangbin@honraytech.com>
// +----------------------------------------------------------------------

namespace app\admin\model;

use app\admin\model\Common;

class Bidding extends Common
{
    /**
     * 为了数据库的整洁，同时又不影响Model和Controller的名称
     * 我们约定每个模块的数据表都加上相同的前缀，比如微信模块用weixin作为数据表前缀
     */
    protected $name = 'admin_bidding';

    /**
     * [getDataList 获取列表]
     * @linchuangbin
     * @DateTime  2017-02-10T21:07:18+0800
     * @return    [array]
     */

    public function getDataList($keywords, $page, $limit,$param)
    {
        $map = [];
        if ($param['keywords']) {
            $map['name'] = ['like', '%'.$keywords.'%'];
        }
        if ($param['serial']) {
            $map['serial'] = $param['serial'];
        }
        if ($param['sTime11']) {
            $map['create_time'] = ['egt',$param['sTime']];
            $map['create_time'] = ['elt',$param['eTime']];
        }
        if ($param['type']) {
            $map['type'] = $param['type'];
        }
        $dataCount = $this->alias('bidding')->where($map)->count('id');
        $data['list'] = $this->where($map)->page($page, $limit)->select();
        $data['dataCount'] = $dataCount;
        return $data;
    }
}